
<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <meta charset="utf-8"></meta>
      <meta name="viewport" content="width=device-width, initial-scale=1.0"></meta>
      <title>17.2.&nbsp;Deprecated: Manual Indexes - Chapter&nbsp;17.&nbsp;Text and Lookup Indexes</title>
      <link rel="stylesheet" type="text/css" href="../../docbook.css"></link>
      <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"></link>
      <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css"></link>
      <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.1.0/css/font-awesome.min.css"></link>
      <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans:400,300,400italic,600,300italic"></link>
      <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.11.0/codemirror.min.css"></link>
      <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.11.0/theme/neo.min.css"></link>
      <link rel="stylesheet" type="text/css" href="../../css/chunked-base.css"></link>
      <link rel="stylesheet" type="text/css" href="../../css/extra.css"></link><script src="//code.jquery.com/jquery-1.12.4.js" type="text/javascript"></script><script src="//cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js" type="text/javascript"></script><script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" type="text/javascript"></script><script src="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.11.0/codemirror.min.js" type="text/javascript"></script><script src="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.11.0/addon/runmode/runmode.min.js" type="text/javascript"></script><script src="//cdnjs.cloudflare.com/ajax/libs/codemirror/5.11.0/mode/cypher/cypher.min.js" type="text/javascript"></script><script src="../../javascript/datatable.js" type="text/javascript"></script><script src="../../javascript/colorize.js" type="text/javascript"></script><script src="../../javascript/tabs-for-chunked.js" type="text/javascript"></script><script src="../../javascript/mp-nav.js" type="text/javascript"></script><script src="../../javascript/versionswitcher.js" type="text/javascript"></script><script src="../../javascript/version.js" type="text/javascript"></script><script src="//s3-eu-west-1.amazonaws.com/alpha.neohq.net/docs/new-manual/assets/search.js" type="text/javascript"></script><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"></meta>
      <link rel="prev" href="../schema-index-operations/" title="17.1.&nbsp;Schema Index Procedures"></link>
      <link rel="next" href="../fulltext-index/" title="17.4.&nbsp;Deprecated: Full Text Search"></link>
      <link rel="shortcut icon" href="https://neo4j.com/wp-content/themes/neo4jweb/favicon.ico"></link><script>
        $(document).ready(function() {
          CodeMirror.colorize();
          tabTheSource($('body'));
          var $header = $('header').first();
          $header.prepend(
            $('<a href="" id="logo"><img src="https://neo4j.com/wp-content/themes/neo4jweb/assets/images/neo4j-logo-2015.png" alt="Neo4j Logo"></img></a>')
          );
          var $sidebar = $('<div id="sidebar-wrapper"></div>');
          $.get('toc.html', function (d){
            $(d).appendTo($sidebar);
            highlightToc();
            highlightLibraryHeader();
          });
          $sidebar.insertAfter($('header').first());
        });
        </script></head>
   <body>
      <header>
         <div class="searchbox">
            <form id="search-form" class="search" name="search-form" role="search"><input id="search-form-input" name="q" title="search" type="search" lang="en" placeholder="Search Neo4j docs..." aria-label="Search Neo4j documentation" max-length="128" required="required"></input><input id="search-form-button" type="submit" value="Search"></input></form>
         </div>
         <ul class="documentation-library">
            <li><a href="https://neo4j.com/docs/operations-manual/current">Operations Manual</a></li>
            <li><a href="https://neo4j.com/docs/developer-manual/current/">Developer Manual</a></li>
            <li><a href="https://neo4j.com/docs/ogm-manual/current/">OGM Manual</a></li>
            <li><a href="https://neo4j.com/docs/graph-algorithms/current/">Graph Algorithms</a></li>
            <li><a href="https://neo4j-contrib.github.io/neo4j-apoc-procedures/3.4/">APOC</a></li>
            <li><a href="https://neo4j.com/docs/java-reference/current/">Java Reference</a></li>
         </ul>
         <nav id="header-nav"><span class="nav-previous"><a accesskey="p" href="../schema-index-operations/"><span class="fa fa-long-arrow-left" aria-hidden="true"></span>Schema Index Procedures</a></span><span class="nav-current">
               <p class="nav-title hidden">17.2.&nbsp;Deprecated: Manual Indexes</p></span><span class="nav-next"><a accesskey="n" href="../fulltext-index/">Deprecated: Full Text Search<span class="fa fa-long-arrow-right" aria-hidden="true"></span></a></span></nav>
      </header>
      <div id="search-results" class="hidden"></div>
      <section class="section" id="manual-indexes">
         <div class="titlepage">
            <div>
               <div>
                  <h2 class="title" style="clear: both"><a class="anchor" href="#manual-indexes"></a>17.2.&nbsp;Deprecated: Manual Indexes
                  </h2>
               </div>
            </div>
         </div>
         <div class="admonitionblock warning">
            <table>
               <tbody>
                  <tr>
                     <td class="icon"><i class="fa icon-warning" title="warning"></i></td>
                     <td class="content">
                        <p>These Index procedures in the namespaces <code class="literal">apoc.index.*</code> are deprecated and will be removed from APOC soon.
                           From version 3.5 Neo4j provides built-in, case-insensitive, configurable fulltext indices.
                        </p>
                     </td>
                  </tr>
               </tbody>
            </table>
         </div>
         <section class="section" id="_index_queries">
            <div class="titlepage">
               <div>
                  <div>
                     <h3 class="title"><a class="anchor" href="#_index_queries"></a>17.2.1.&nbsp;Index Queries
                     </h3>
                  </div>
               </div>
            </div>
            <p>Procedures to add to and query manual indexes</p>
            <div class="admonitionblock note">
               <table>
                  <tbody>
                     <tr>
                        <td class="icon"><i class="fa icon-note" title="note"></i></td>
                        <td class="content">
                           <p>Please note that there are (case-sensitive) <a class="link" href="http://neo4j.com/docs/developer-manual/current/#cypher-schema" target="_top">automatic schema indexes</a>, for equality, non-equality, existence, range queries, starts with, ends-with and contains!
                           </p>
                        </td>
                     </tr>
                  </tbody>
               </table>
            </div>
            <div class="informaltable">
               <div class="table" id="d0e20091">
                  <table class="informaltable" border="1">
                     <colgroup>
                        <col class="col_1"></col>
                        <col class="col_2"></col>
                     </colgroup>
                     <tbody>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">apoc.index.addAllNodes('index-name',{label1:['prop1',&#8230;&#8203;],&#8230;&#8203;}, {options})</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>add all nodes to this full text index with the given fields, additionally populates a 'search' index field with all of them
                                 in one place
                              </p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">apoc.index.addNode(node,['prop1',&#8230;&#8203;])</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>add node to an index for each label it has</p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">apoc.index.addNodeByLabel('Label',node,['prop1',&#8230;&#8203;])</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>add node to an index for the given label</p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">apoc.index.addNodeByName('name',node,['prop1',&#8230;&#8203;])</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>add node to an index for the given name</p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">apoc.index.addNodeMap(node,{key:value})</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>add node to an index for each label it has with the given attributes which can also be computed</p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">apoc.index.addNodeMapByName(index, node,{key:value})</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>add node to an index for each label it has with the given attributes which can also be computed</p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">apoc.index.addRelationship(rel,['prop1',&#8230;&#8203;])</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>add relationship to an index for its type</p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">apoc.index.addRelationshipByName('name',rel,['prop1',&#8230;&#8203;])</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>add relationship to an index for the given name</p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">apoc.index.addRelationshipMap(rel,{key:value})</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>add relationship to an index for its type indexing the given document which can be computed</p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">apoc.index.addRelationshipMapByName(index, rel,{key:value})</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>add relationship to an index for its type indexing the given document which can be computed</p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">apoc.index.removeNodeByName('name',node) remove node from an index for the given name</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>apoc.index.removeRelationshipByName('name',rel) remove relationship from an index for the given name</p>
                           </td>
                        </tr>
                     </tbody>
                  </table>
               </div>
            </div>
            <div class="informalfigure">
               <div class="mediaobject"><img src="https://raw.githubusercontent.com/neo4j-contrib/neo4j-apoc-procedures/3.4/docs/images/apoc.index.nodes-with-score.jpg" width="600" alt="apoc.index.nodes with score"></img></div>
            </div>
            <div class="informaltable">
               <div class="table" id="d0e20191">
                  <table class="informaltable" border="1">
                     <colgroup>
                        <col class="col_1"></col>
                        <col class="col_2"></col>
                     </colgroup>
                     <tbody>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">apoc.index.search('index-name', 'query') YIELD node, weight</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>search for the first 100 nodes in the given full text index matching the given lucene query returned by relevance</p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">apoc.index.nodes('Label','prop:value*') YIELD node, weight</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>lucene query on node index with the given label name</p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">apoc.index.relationships('TYPE','prop:value*') YIELD rel, weight</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>lucene query on relationship index with the given type name</p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">apoc.index.between(node1,'TYPE',node2,'prop:value*') YIELD rel, weight</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>lucene query on relationship index with the given type name bound by either or both sides (each node parameter can be null)</p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">apoc.index.out(node,'TYPE','prop:value*') YIELD node, weight</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>lucene query on relationship index with the given type name for <span class="strong"><strong>outgoing</strong></span> relationship of the given node, <span class="strong"><strong>returns end-nodes</strong></span></p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">apoc.index.in(node,'TYPE','prop:value*') YIELD node, weight</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>lucene query on relationship index with the given type name for <span class="strong"><strong>incoming</strong></span> relationship of the given node, <span class="strong"><strong>returns start-nodes</strong></span></p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">apoc.index.nodes.count('Label','prop:value*') YIELD value</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>lucene query on node index with the given label name, <span class="strong"><strong>returns count-nodes</strong></span></p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">apoc.index.relationships.count('TYPE','prop:value*') YIELD value</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>lucene query on relationship index with the given type name, <span class="strong"><strong>returns count-relationships</strong></span></p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">apoc.index.between.count(node1,'TYPE',node2,'prop:value*') YIELD value</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>lucene query on relationship index with the given type name bound by either or both sides (each node parameter can be null),
                                 <span class="strong"><strong>returns count-relationships</strong></span></p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">apoc.index.out.count(node,'TYPE','prop:value*') YIELD value</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>lucene query on relationship index with the given type name for <span class="strong"><strong>outgoing</strong></span> relationship of the given node, <span class="strong"><strong>returns count-end-nodes</strong></span></p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">apoc.index.in.count(node,'TYPE','prop:value*') YIELD value</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>lucene query on relationship index with the given type name for <span class="strong"><strong>incoming</strong></span> relationship of the given node, <span class="strong"><strong>returns count-start-nodes</strong></span></p>
                           </td>
                        </tr>
                     </tbody>
                  </table>
               </div>
            </div>
         </section>
         <section class="section" id="_index_management">
            <div class="titlepage">
               <div>
                  <div>
                     <h3 class="title"><a class="anchor" href="#_index_management"></a>17.2.2.&nbsp;Index Management
                     </h3>
                  </div>
               </div>
            </div>
            <div class="informaltable">
               <div class="table" id="d0e20313">
                  <table class="informaltable" border="1">
                     <colgroup>
                        <col class="col_1"></col>
                        <col class="col_2"></col>
                     </colgroup>
                     <tbody>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">CALL apoc.index.list() YIELD type,name,config</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>lists all manual indexes</p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">CALL apoc.index.remove('name') YIELD type,name,config</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>removes manual indexes</p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">CALL apoc.index.forNodes('name',{config}) YIELD type,name,config</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>gets or creates manual node index</p>
                           </td>
                        </tr>
                        <tr>
                           <td style="text-align: left; vertical-align: top; ">
                              <p><code class="literal">CALL apoc.index.forRelationships('name',{config}) YIELD type,name,config</code></p>
                           </td>
                           <td style="text-align: left; vertical-align: top; ">
                              <p>gets or creates manual relationship index</p>
                           </td>
                        </tr>
                     </tbody>
                  </table>
               </div>
            </div>
            <p><span class="formalpara-title">Add node to index example.&nbsp;</span>
               
            </p><pre class="programlisting highlight"><code data-lang="cypher">match (p:Person) call apoc.index.addNode(p,["name","age"]) RETURN count(*);
// 129s for 1M People
call apoc.index.nodes('Person','name:name100*') YIELD node, weight return * limit 2</code></pre><p>
               
            </p>
         </section>
      </section>
      <footer><script type="text/javascript">
          (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
          })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
          //Allow Linker
          ga('create', 'UA-1192232-34','auto', {'allowLinker': true});
          ga('send', 'pageview');
          // Load the plugin.
          ga('require', 'linker');
          // Define which domains to autoLink.
          ga('linker:autoLink', ['neo4j.org','neo4j.com','neotechnology.com','graphdatabases.com','graphconnect.com']);
        </script><script type="text/javascript">
          document.write(unescape("%3Cscript src='//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E"));
        </script><script>Munchkin.init('773-GON-065');</script></footer>
   </body>
</html>